#include "CA/neighbours.h"

namespace neighbours
{

    vector<shared_ptr<Tile> > vn(shared_ptr<IGrid> g,int i, int j)
    {

        vector<shared_ptr<Tile> > v;
        int width=g->width();
        int height=g->height();

        if(i>0)v.push_back(g->tiles[i-1][j]);//N
        else v.push_back(g->tiles[height-1][j]);
        if(j<width-1)v.push_back(g->tiles[i][j+1]);//E
        else v.push_back(g->tiles[i][0]);
        if(i<height-1)v.push_back(g->tiles[i+1][j]);//S
        else v.push_back(g->tiles[0][j]);
        if(j>0)v.push_back(g->tiles[i][j-1]);//W
        else v.push_back(g->tiles[i][width-1]);
        return v;
    }
}
